package univ.bme.accounting.domain;

import javax.persistence.Access;
import javax.persistence.AccessType;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import java.util.List;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@Getter
@Setter
@NoArgsConstructor

@Entity
@Access(AccessType.FIELD)
@Table(name="users")
public class User {
	
	public static final String USER_ROLE = "USER";
	public static final String ADMIN_ROLE = "ADMIN";
	public static final String PUBLIC_DATA = "Y";
	public static final String NON_PUBLIC_DATA = "N";
		
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private int id;
	
	@OneToMany(mappedBy = "user", cascade = CascadeType.REMOVE)
	private List<Category> categories;
	
	@OneToMany(mappedBy = "user", cascade = CascadeType.REMOVE)
	private List<Comment> comments;
	
	
	@Column(length=20,nullable=false,unique=true)
	private @Getter String username;
	
	@Column(length=50,nullable=false)
	private String password;
	
	@Column(length=50,nullable=true)
	private String name;
	
	@Column(length=10,nullable=false)
	private String role;
	
	@Column(length=5,nullable=true)
	private String visible;
	
}
